home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / applications / 560 < prev    next >
Encoding:
Text File  |  1996-08-05  |  28.8 KB  |  801 lines

  1. Path: news.restena.lu!usenet
  2. From: manou.billa@ci.educ.lu (Manou BILLA)
  3. Newsgroups: comp.sys.amiga.applications
  4. Subject: Re: computer algebra prog on Amiga  ?
  5. Date: 13 Jan 1996 02:53:36 GMT
  6. Organization: Not organized
  7. Message-ID: <29144.6586T229T2860@ci.educ.lu>
  8. References: <4d1k6m$fs6@rc1.vub.ac.be>
  9. Reply-To: manou.billa@ci.educ.lu
  10. NNTP-Posting-Host: slip4.restena.lu
  11. X-Newsreader: THOR 2.22 (Amiga;TCP/IP)
  12.  
  13.  
  14. On 11-Jan-96 01:04:38, COLET VINCENT (vcolet@vub.ac.be) wrote to All () about
  15. computer algebra prog on Amiga  ? (<4d1k6m$fs6@rc1.vub.ac.be>):
  16.  
  17. Hi COLET VINCENT
  18.  
  19. >Can we found "computer algebra" handle programmes on Amiga ?
  20. >(like Mathematica, Mapple, ... on PC/Mac ...)
  21.  
  22. Yes there's MapleV R3 for the AMIGA. I don't know the price but it seems to be
  23. worth it! (I don't have it :-(()
  24.  
  25. But there's a program called 'gp amiga' (plus pari though not needed).
  26. This program is PD. You can't do as much symbolic math as Mathematica,
  27. Maple, Reduce ro MacSyma with it, but this program is unbeatable when doing
  28. numerical maths!  with Pari symbolic math is possible, but you can't compare
  29. it to one of the above programs.
  30.  
  31. It is very fast. According to the doc it does compute up to 5 - 100 times
  32. faster than one of the programs mentioned above.
  33.  
  34. The current gp (Amiga version) is version 1.38.3 (The on I use) comes in
  35. several compiled versions (depends on CPU used).
  36. The program is a port from UN*X boxes (SPARC, HP, VAX, MAC, PC, ATARI ...).
  37. It is SHELL driven but you can even plot graphs and output them to postscript
  38. printers and files or as LaTeX files.
  39. The included DOC (in DVI format) is about 150 DIN A4 pages with a lot of
  40. examples and explanations of the PARI programming language (much like LISP).
  41.  
  42. The program is comparable to musimp/mumath on CP/M computers some years ago.
  43.  
  44. Here's the AMIGA.readme:
  45.  
  46. About PARI             (14 dec 1993)
  47. ----------
  48.  
  49. PARI is the name of a sophisticated and free math package. GP is a
  50. calculator that offers all the features of PARI and some more. PARI
  51. uses *infinite* precision rational numbers and *arbitrary* precision
  52. floating point numbers.
  53.  
  54. You can use complex numbers, vectors, matrices, polynomials, rational
  55. functions and taylor expansions. PARI also handles integers mod n,
  56. finite fields, algebraic numbers and p-adic numbers. PARI includes
  57. standard numerical methods and the GP calculator also includes
  58. hi-resolution plotting.
  59.  
  60. PARI is written by four professional number theorists, C. Batut,
  61. D. Bernardi, H. Cohen and M. Olivier. The latter two are Professors of
  62. Mathematics.
  63.  
  64. -------
  65.  
  66. This amiga distribution contains the GP calculator compiled for
  67. different processors, an emacs mode for running GP, partial
  68. documentation, and all the amiga specific files I used to compile GP.
  69. The amiga hi-resolution plotting functions are written by Jerry
  70. Tunnell, who kindly let me use and distribute them.
  71.  
  72. If you want full source and documentation, you will have to get the
  73. source distribution. It *should* be available where you found this
  74. package, as file pari-1.38.3.gz or something similar (*Please* keep
  75. this archive and the source archive together. If you like GP, you will
  76. probably want the documentation too). If you can't find the source
  77. anywhere else, you can try to ftp to megrez.ceremab.u-bordeaux.fr,
  78. directory pub/pari/unix. This is the main PARI site.
  79.  
  80.  
  81. Files
  82. -----
  83.  
  84. amiga/                   Amiga specific files and sources.
  85.         makefile.68000   Makefiles for different amiga versions.
  86.         makefile.68020
  87.         makefile.68881
  88.         mpAmiga.s        Assembler file (gcc syntax) for the 68020 versions.
  89.                          Converted from mp.s with the convert68k.el program in
  90.                          the elisp directory.
  91.         plotAmiga.c      Hi-resolution plotting functions, written by J.B.
  92. Tunnell.
  93.         version68k.diff  Source diffs to add an Amiga version string.
  94.         versionport.diff
  95.  
  96. bin/
  97.         gp.68000         GP binaries for different processors.
  98.         gp.68020
  99.         gp.68881
  100.  
  101. doc/                     This directory does not contain the complete
  102. documentation,
  103.         usersch3.tex     only one file that is needed by pari.el
  104.  
  105. elisp/
  106.         convert68k.el    Elisp program to convert a sun3 style 68k assembler
  107. file
  108.                          (read mp.s) into something that amiga gcc can
  109. understand.
  110.         pari.el          An Emacs mode for the GP calculator. Desribed below
  111. and
  112.         pari.elc         in the file pari.txt
  113.         pari.menu        Used by pari.el.
  114.         pari.txt         A description of pari-mode
  115.  
  116. examples/
  117.         EXPLAIN          Description of the examples.
  118.         Makefile         Note that you cannot compile the C example
  119.         Makesimple       without the libpari.a library.
  120.         bench.gp
  121.         clareg.gp
  122.         lucas.gp
  123.         mattrans.c
  124.         rho.gp
  125.         squfof.gp
  126.         tutnf.gp
  127.         tutnfout
  128.  
  129.  
  130. Starting PARI
  131. -------------
  132.  
  133. First, you need to install Markus Wild's ixemul.library, if you don't
  134. have it already. Version 39.45 is the most recent non-buggy version I
  135. know of (39.47 seems to be unreliable). This library is available on
  136. Aminet (for example at ftp.luth.se) and is included in the gcc
  137. distribution.
  138.  
  139. GP (file gp.68020 or whichever version you use) takes three command line
  140. options. The most important is '-s STACKSIZE'. This sets the initial
  141. size of the internal PARI stack (not to be confused with the task
  142. stack). The default value is 4 MB which may be more RAM than you have
  143. available. Try 'gp -s 1000000' or 'gp -s 100000' if GP refuses to
  144. start. The other two flags are '-p PRIMELIMIT' and '-b BUFFERSIZE'.
  145. Default values are 500000 and 30000 respectively.
  146.  
  147. Talking about the task stack, I don't know exactly how large it must
  148. be. I use a stack of 100000 bytes, and that seems to be enough. To set
  149. the task stack, use the command 'STACK 100000' command from the shell,
  150. not the -s option to GP.
  151.  
  152. At the pari command prompt (default '?'), \q or CTRL-\ exits GP. You
  153. can type '?' to get some on-line help. Note that running GP inside
  154. emacs gives you better online help.
  155.  
  156. The GP command interface is quite straight forward if you are used to
  157. MATLAB or similar systems. Note that with GP both vectors and matrices
  158. are typed with with square brackets '[' ']', with comma ',' separating
  159. elements on the same row and semicolon ';' separating rows. For
  160. example, a 2-2 matrix is typed '[1,2 ; 3,4]'.
  161.  
  162. The emacs mode.
  163. ---------------
  164. To use this on the amiga, you must make sure that you have mounted the
  165. FIFO: device, and that the SHELL environment variable is set to some
  166. unix-style shell. I use the shell distributed with gcc, a port of
  167. pdksh (file name gcc/bin/sh). The shell distributed with GNUemacs
  168. might work too, but I haven't tried it. The emacs mode is described in
  169. the file elisp/pari.txt. If you don't wan't to edit the pari.el file,
  170. you should assign PARI: to the directory where you have installed
  171. PARI.
  172.  
  173. Known bugs
  174. ----------
  175. GP does not respond to CTRL-C when run from the shell. However, if you
  176. send the CTRL-C signal from another shell window (with the BREAK
  177. command) or type CTRL-C in GP's emacs buffer, GP is interrupted.
  178.  
  179. A free() call occasionally failes when using the 68000 or 68020
  180. versions of GP. I have not had this problem with the 68881 version.
  181.  
  182. I'm tempted to blame both these problems on the ixemul.library, but
  183. I'm not sure what happens.
  184.  
  185. For those who are curious about the differences between the three
  186. versions gp.68000, gp.68020 and gp.68881:
  187.  
  188. * The first two are compiled with gcc -msoftfloat instead of gcc
  189. -m68881. If a 68881 processor is present, all three version makes use
  190. of it. The performance difference between the gp.68020 and the 68881
  191. version should be rather small on any machine that can run both. I
  192. included the 68881 because it seemes more reliable.
  193.  
  194. * In the 68020 and 68881 versions, some low level functions are
  195. written in 68020 assembler, while the 68000 version is written
  196. entirely in C and is compiled with gcc -m68000 to make sure that it
  197. contains only 68000 instructions.
  198.  
  199. -------
  200. Enjoy GP!
  201.  
  202. Feel free to send me comments and questions (and even bug reports).
  203.         Niels M÷ller
  204.         StΣlldalsvΣgen 11
  205.         122 43 Enskede
  206.         SWEDEN
  207. email:  nisse@lysator.liu.se
  208.  
  209. For questions and bug reports not specific to the amiga version, you
  210. can also write to the authors:
  211.         pari@ceremab.u-bordeaux.fr
  212.  
  213.  
  214. --------------------------- end readme AMIGA: gp amiga/ pari ------
  215.  
  216.  
  217. And here's an example of the calculation of 1000! (factorial of 1000)
  218.  
  219. Calculation time with display of the result on my A3000 (68030, 68882, MMU, 25
  220. MHz, with 12 MB Fast, 2 MB CHIP) on a 1024x756x8 Workbench screen (TIGA gfx
  221. board) was:
  222.  
  223.                 3 secs!!!
  224.  
  225.  
  226. Here's the result: (sorry for the bad formatting of the output, but that is
  227.                     the fault of my text editor)
  228.  
  229. Work2:science/gp/gp.68881
  230.             GP/PARI CALCULATOR Version 1.38.3
  231.                       (68020 version)
  232.  
  233. Copyright 1989,1993 by C. Batut, D. Bernardi, H. Cohen and M. Olivier
  234.  
  235. Type ? for help
  236.  
  237. \precision      = 28
  238. \serieslength   = 16
  239. \format         = g0.28
  240. \prompt         = ?
  241. stacksize = 4000000, prime limit = 500000, buffersize = 30000
  242. ? ?
  243.  
  244. 1: Standard monadic or dyadic OPERATORS
  245. 2: CONVERSIONS and similar elementary functions
  246. 3: TRANSCENDENTAL functions
  247. 4: NUMBER THEORETICAL functions
  248. 5: Functions related to ELLIPTIC CURVES
  249. 6: Functions related to general NUMBER FIELDS
  250. 7: POLYNOMIALS and power series
  251. 8: Vectors, matrices and LINEAR ALGEBRA
  252. 9: SUMS, products, integrals and similar functions
  253. 10: GRAPHIC functions
  254. 11: PROGRAMMING under GP
  255.  
  256. Further help: ?n (1<=n<=11), ?functionname, or ?\ (keyboard commands)
  257.  
  258. ? 1000!
  259. %1 =
  260. 402387260077093773543702433923003985719374864210714632543799910429938512398629
  261. 020592044208486969404800479988610197196058
  262. 631666872994808558901323829669944590997424504087073759918823627727188732519779
  263. 50595099527612087497546249704360141827809464649
  264. 629105639388743788648733711918104582578364784997701247663288983595573543251318
  265. 53239584630755574091142624174743493475534286465
  266. 766116677973966688202912073791438537195882498081268678383745597317461360853795
  267. 34524221586593201928090878297308431392844403281
  268. 231558611036976801357304216168747609675871348312025478589320767169132448426236
  269. 13141250878020800026168315102734182797770478463
  270. 586817016436502415369139828126481021309276124489635992870511496497541990934222
  271. 15668325720808213331861168115536158365469840467
  272. 089756029009505376164758477284218896796462449451607653534081989013854424879849
  273. 59953319101723355556602139450399736280750137837
  274. 615307127761926849034352625200015888535147331611702103968175921510907788019393
  275. 17811419454525722386554146106289218796022383897
  276. 147608850627686296714667469756291123408243920816015378088989396451826324367161
  277. 67621791689097799119037540312746222899880051954
  278. 444142820121873617459926429565817466283029555702990243241531816172104658320367
  279. 86906117260158783520751516284225540265170483304
  280. 226143974286933061690897968482590125458327168226458066526769958652682272807075
  281. 78139185817888965220816434834482599326604336766
  282. 017699961283186078838615027946595513115655203609398818061213855860030143569452
  283. 72242063446317974605946825731037900840244324384
  284. 656572450144028218852524709351906209290231364932734975655139587205596542287497
  285. 74011413346962715422845862377387538230483865688
  286. 976461927383814900140767310446640259899490222221765904339901886018566526485061
  287. 79970235619389701786004081188972991831102117122
  288. 984590164192106888438712185564612496079872290851929681937238864261483965738229
  289. 11231250241866493531439701374285319266498753372
  290. 189406942814341185201580141233448280150513996942901534830776445690990731524332
  291. 78288269864602789864321139083506217095002597389
  292. 863554277196742822248757586765752344220207573630569498825087968928162753848863
  293. 39690995982628095612145099487170124451646126037
  294. 902930912088908694202851064018215439945715680594187274899809425474217358240106
  295. 36774045957417851608292301353580818400969963725
  296. 242305608559037006242712434169090041536901059339838357779394109700277534720000
  297. 00000000000000000000000000000000000000000000000
  298. 000000000000000000000000000000000000000000000000000000000000000000000000000000
  299. 00000000000000000000000000000000000000000000000
  300. 0000000000000000000000000000000000000000000000000000000000000000000000000
  301. ?
  302.  
  303. ---------------------- end example 1000! ----------------------
  304.  
  305. Here's the readme text of the included examples:
  306.  
  307. Several examples of complete and non-trivial GP programs are given in this
  308. directory (as well as the C program mattrans.c using the Pari library
  309. described
  310. in Chapter 4 of the users' manual). This file gives a brief description of
  311. these programs. All these programs should be read into GP by the command
  312. \r file.
  313.  
  314. 1) bench.gp
  315.  
  316. This program computes the first 1000 terms of the Fibonacci sequence, the
  317. product p of successive terms, and the lowest common multiple q. It outputs
  318. the ratio log(p)/log(q) every 10 terms (this ratio tends to pi^2/6 as k
  319. tends to infinity). The name bench.gp comes from the fact that this program
  320. is one (among many) examples where GP/PARI performs orders of magnitude
  321. faster than systems such as Maple or Mathematica (try it!).
  322.  
  323. here's the script file:
  324.  
  325. u=1;v=1;p=1;q=1;
  326. for(k=1,1000,w=u+v;u=v;v=w;p=p*w;q=lcm(q,w);if(k%10,,print(k,"
  327. ",log(p)/log(q))));
  328.  
  329.  
  330. 2) clareg.gp
  331.  
  332. Written entirely in the GP language without using the function buchgen,
  333. the programs included in this file allow you in many cases to compute the
  334. class number, the structure of the class group and a system of fundamental
  335. units of a general number field (this programs sometimes fails to give an
  336. answer). It can work only if initalg finds a power basis.
  337. Evidently it is much less powerful and much slower than the function
  338. buchgen, but it is given as an example of a sophisticated use of GP.
  339. The first thing to do is to call the function clareg(pol,limp,lima,extra)
  340. where pol is the monic irreducible polynomial defining the number field, limp
  341. is the prime factor base limit (try values between 19 and 113), lima is
  342. another search limit (try 50 or 100) and extra is the number of desired extra
  343. relations (try 2 to 10). The program prints the number of relations that it
  344. needs, and tries to find them. If you see that clearly it slows down too much
  345. before succeeding, abort and try other values. If it succeeds, it will print
  346. the class number, class group, regulator. These are tentative values. Then
  347. use the function check(lim) (take lim=200 for example) to check if the value
  348. is consistent with the value of the L-series (the value returned by check
  349. should be close to 1). Finally, the function fu() (no parameters) returns a
  350. family of units which generates the unit group (you must extract a system
  351. of fundamental units yourself).
  352.  
  353. script:
  354.  
  355. rgcd(a,b,r)=a=abs(a);b=abs(b);while(b>0.01,r=a-b*trunc(a/b);a=b;b=r);a
  356. {f(a,b,s,n,l)=s=a+b*t;n=abs(norm(s));nin=n;mv=vvector(li,j,0);
  357. forprime(k=2,plim,l=0;while((n%k)==0,l=l+1;n=n/k);if(l,j=ind[k];cp=v[j][2];
  358. while((a+b*cp)%k,j=j+1;cp=v[j][2]);mv[j]=l,));
  359. if(n==1,lno=log(nin)/dep;vreg=vvector(lireg,j,if(j<=r1,log(abs(a+b*re[j])),log
  360. (norm(a+b*re[j]))));
  361. if(res,mreg=concat(mreg,vreg);m=concat(m,mv);
  362. areg=concat(areg,a+b*t),mreg=mat(vreg);m=mat(mv);areg=[a+b*t]);
  363. res=res+1;print1("(",res,": ",a,", ",b,")"),)}
  364. {clareg(p,plim,lima,extra)=vi=initalg(p);p=vi[1];t=modp(x,p);
  365. dp=disc(p);r=vi[6];r1=vi[2][1];findex=vi[4];
  366. if(findex>1,print("sorry, the case f>1 is not implemented");1/0,);
  367. print("discriminant = ",vi[3],", signature = ",vi[2]);
  368. dep=length(p)-1;re=vector(lireg=(dep+r1)/2,j,if(j<=r1,real(r[j]),r[2*j-r1-
  369. 1]));
  370. ind=vector(plim,j,0);v=[];
  371. forprime(k=2,plim,w=lift(factmod(p,k));find=0;for(l=1,length(w[,1]),\
  372. fa=w[l,1];if(length(fa)==2,if(find,,find=1;ind[k]=length(v)+1);
  373. v=concat(v,[[k,-coeff(fa,0),w[l,2]]]),)));
  374. li=length(v);co=li+extra;res=0;print("need ",co);
  375. a=1;b=1;f(0,1);while(res<co,if(gcd(a,b)==1,f(a,b);f(-a,b),);
  376. a=a+1;if(a*b>lima,b=b+1;a=1,));print(" ");mh=hermite(m);ms=matsize(mh);
  377. if(ms[1]==ms[2],mhs=smith(mh);mh1=[mhs[1]];j=1;clh=mhs[1];
  378. while(j<length(mhs),j=j+1;if(mhs[j]>1,mh1=concat(mh1,mhs[j]);clh=clh*mhs[j],))
  379. ;
  380. print("class number = ",clh,", class group =
  381. ",mh1);km=kerint(m);mregh=mreg*km;
  382. if(lireg==1,a1=1;print("regulator = 1"),coreg=length(mregh);
  383. if(coreg<lireg-1,print("not enough relations for regulator: matrix size =
  384. ",matsize(mregh)),mreg1=extract(mregh~,cov=vector(lireg-
  385. 1,k,k))~;a1=det(extract(mreg1,cov));
  386. for(j=lireg,coreg,a1=rgcd(a1,det(extract(mreg1,vector(lireg-1,k,k+j-
  387. lireg+1)))));
  388. print("regulator = ",a1))),print("not enough relations for class group: matrix
  389. size = ",ms));}
  390. {check(lim)=r1=vi[2][1];pol=vi[1];
  391. z=2^(-r1)*(2*pi)^((r1+1-length(pol))/2)*sqrt(abs(vi[3]));
  392. forprime(q=2,lim,z=z*(q-1)/q;fa=factmod(pol,q);
  393. for(j=1,length(fa[,1]),z=z/(1-1/q^(length(fa[j,1])-1))));
  394. clh*a1/rootsof1(vi)[1]/z}
  395. {fu()=fw=[];for(k=1,length(km),ckm=km[,k];s=1;
  396. for(j=1,length(ckm),s=s*areg[j]^ckm[j]);fw=concat(fw,s));fw}
  397.  
  398.  
  399. 3) lucas.gp
  400.  
  401. The half line function lucas(p) defined in this file performs the Lucas-Lehmer
  402. primality test on the Mersenne number 2^p-1. If the result is 1, the Mersenne
  403. number is prime, otherwise not.
  404.  
  405. 4) rho.gp
  406.  
  407. A simple implementation of Pollard's rho method. The function rho(n) outputs
  408. the complete factorization of n in the same format as factor.
  409.  
  410. script:
  411.  
  412. rho1(n,x,y)=x=2;y=5;while(gcd(y-
  413. x,n)==1,x=(x*x+1)%n;y=(y*y+1)%n;y=(y*y+1)%n);gcd(n,y-x)
  414. rho2(n,m)=m=rho1(n);if(isprime(m),print(m),rho2(m));if(isprime(n/m),print(n/m)
  415. ,rho2(n/m));
  416. rho(n,m)=m=smallfact(n);print(m);n=m[length(m[,1]),1];if(isprime(n),,rho2(n));
  417.  
  418.  
  419. 5) squfof.gp
  420.  
  421. This defines a function squfof of a positive integer variable n, which may
  422. allow you to factor the number n. SQUFOF is a very nice factoring
  423. method invented in the 70's by D. Shanks for factoring integers, and is
  424. reasonably fast for numbers having up to 15 or 16 digits. The squfof program
  425. which is given is a very crude implementation. It also prints out some
  426. intermediate information as it goes along. The final result is some factor of
  427. the number to be factored.
  428.  
  429. script:
  430.  
  431. {squfof(n)=if(isprime(n),s=n,if(issquare(n),s=isqrt(n),p=smallfact(n)[1,1];
  432. if(p!=n,s=p,if(n%4==1,dd=n;d=isqrt(dd);b=2*((d-1)\2)+1,dd=4*n;d=isqrt(dd);
  433. b=2*(d\2));f=qfr(1,b,(b^2-dd)/4,0.);q=[];lq=0;ii=0;l=isqrt(d);flag=1;
  434. while(flag,f=rhorealnod(f,d);ii=ii+1;a=compo(f,1);
  435. if(ii%2,fl=0,fl=issquare(a));if(fl,as=isqrt(a);j=1;
  436. while((j<=lq)&&fl,fl=(as!=q[j]);
  437. j=j+1);if(as==1,s=0;flag=0,),);if(fl==0,if(abs(a)<=l,q=concat(q,abs(a));
  438. print(q);lq=lq+1,),flag=0;gs=gcd(as,dd);print("i = ",ii);print(f);
  439. gs=gcd(gs,bb=compo(f,2));
  440. if(gs>1,s=gs,g=redrealnod(qfr(as,-bb,as*compo(f,3),0.),d);
  441. fl=1;b=compo(g,2);while(fl,b1=b;g=rhorealnod(g,d);b=compo(g,2);fl=(b1!=b));
  442. a=abs(compo(g,1));if(a%2,,a=a/2);s=a))))));s}
  443.  
  444.  
  445. 6) tutnf.gp
  446.  
  447. This is the sequence of GP instructions given in the tutorial in the section
  448. on general number fields.
  449.  
  450. script:
  451.  
  452. \e
  453. t=x^4+24*x^2+585*x+1791;nf=initalg(t);A=nf[1]
  454. \precision=18
  455. gc=galoisconj(A)
  456. \precision=28
  457. aut=gc[4]
  458. pd=primedec(nf,7)
  459. pr1=pd[1]
  460. hp=idealmul(nf,idmat(4),pr1)
  461. hp3=idealmul(nf,hp,idealmul(nf,hp,hp))
  462. \\ or hp3=idealpow(nf,hp,3)
  463. for(j=1,4,print(idealval(nf,hp3,pd[j])))
  464. hpi3=[hp3,[0.,0.]];hr1=ideallllred(nf,hpi3,0)
  465. hr=hr1;for(j=1,3,hr=ideallllred(nf,hr,[1,5]);print(hr))
  466. arch=hr[2]-hr1[2];l1=arch[1];l2=arch[2];
  467. s=real(l1+l2)/4;v1=[l1,l2,conj(l1),conj(l2)]~/2-[s,s,s,s]~
  468. m1=nf[5][1];m=matrix(4,4,j,k,if(j<=2,m1[j,k],conj(m1[j-2,k])));
  469. v=exp(v1);au=gauss(m,v)
  470. vu=round(real(au))
  471. u=mod(nf[7]*vu,A)
  472. norm(u)
  473. f1=factor(subst(char(u,x),x,x^2))
  474. f1=factor(subst(char(-u,x),x,x^2))
  475. v=sqrt(-v)
  476. au=gauss(m,v)
  477. v[1]=-v[1];v[3]=-v[3];au=gauss(m,v)
  478. vu2=round(real(au))
  479. u2=mod(nf[7]*vu2,A)
  480. q=polred2(f1[1,1])
  481. up2=modreverse(mod(q[3,1],f1[1,1]))
  482. mod(subst(lift(up2),x,aut),A)
  483. r=f1[1,1]%(x^2+u);-coeff(r,0)/coeff(r,1)
  484. al=mod(x^2-9,A)
  485. principalidele(nf,al)
  486. for(j=1,4,print(j,": ",idealval(nf,al,pd[j])))
  487. norm(al)
  488. pd14=idealmul(nf,pd[1],pd[4])
  489. idealmul(nf,al,idmat(4))
  490. setrand(1);v=buchgenfu(A,0.2,0.2)[,1]
  491. uf=mod(v[9][1],A)
  492. uu=mod(v[8][2],A)
  493. cu2=log(conjvec(u2));cuf=log(conjvec(uf));cuu=log(conjvec(uu));
  494. lindep(real([cu2[1],cuf[1],cuu[1]]))
  495. lindep([cu2[1],cuf[1],cuu[1],2*i*pi])
  496. u2/uf
  497. ru=nf[8]*vvector(4,j,coeff(v[8][2],j-1))
  498. nf[7]*ru
  499. setrand(1);bnf=buchinitfu(A,0.2,0.2);
  500. bnf[8]
  501. nf=bnf[7];
  502. hp4=idealpow(nf,hp,4)
  503. vis=isprincipal(bnf,hp4)
  504. alpha=mod(nf[7]*vis[2],A)
  505. norm(alpha)
  506. idealmul(nf,idmat(4),mat(vis[2]))
  507. vit=isprincipal(bnf,hp)
  508. pp=isprincipal(bnf,pd14)
  509. al2=mod(nf[7]*pp[2],A)
  510. u3=al2/al
  511. char(u3,x)
  512. me=concat(bnf[3],[2,2]~)
  513. cu3=principalidele(nf,u3)[2]
  514. xc=gauss(real(me),real(cu3))
  515. xd=cu3-me*xc
  516. xu=principalidele(nf,uu)[2]
  517. xd[1]/xu[1]
  518. isunit(bnf,u3)
  519. uu^3*uf
  520.  
  521.  
  522.  
  523. 7) tutnfout
  524.  
  525. This is the slightly edited output of running tutnf.gp (obtained by removing
  526. the ? at the beginning of each command for more legibility).
  527.  
  528.             GP/PARI CALCULATOR Version 1.38.23
  529.                      (Sparcv8 version)
  530.  
  531. Copyright 1989,1993 by C. Batut, D. Bernardi, H. Cohen and M. Olivier
  532.  
  533. Type ? for help
  534.  
  535. \precision      = 28
  536. \serieslength   = 16
  537. \format         = g0.28
  538. \prompt         = ?
  539. stacksize = 4000000, prime limit = 500000, buffersize = 30000
  540. ? ? t=x^4+24*x^2+585*x+1791;nf=initalg(t);A=nf[1]
  541. %1 = x^4 - x^3 - 21*x^2 + 17*x + 133
  542. ? \precision=18
  543.    precision = 18 significant digits
  544. ? gc=galoisconj(A)
  545. %2 = [x, 0, 0, -1/7*x^3 + 5/7*x^2 + 1/7*x - 7]
  546. ? \precision=28
  547.    precision = 28 significant digits
  548. ? aut=gc[4]
  549. %3 = -1/7*x^3 + 5/7*x^2 + 1/7*x - 7
  550. ? pd=primedec(nf,7)
  551. %4 = [[7, [15, 12, 8, 8]~, 1, 1, [5, 4, 6, 4]~], [7, [7, 8, 8, 7]~, 1, 1, [5,
  552. 4, 2, 0]~], [7, [12, 13, 8, 7]~, 1, 1, [7, 2, 4, 0]~], [7, [13, 12, 8, 8]~, 1,
  553. 1, [5, 1, 4, 4]~]]
  554. ? pr1=pd[1]
  555. %5 = [7, [15, 12, 8, 8]~, 1, 1, [5, 4, 6, 4]~]
  556. ? hp=idealmul(nf,idmat(4),pr1)
  557. %6 =
  558. [7 4 5 4]
  559.  
  560. [0 1 0 0]
  561.  
  562. [0 0 1 0]
  563.  
  564. [0 0 0 1]
  565.  
  566. ? hp3=idealmul(nf,hp,idealmul(nf,hp,hp))
  567. %7 =
  568. [343 256 320 172]
  569.  
  570. [0 1 0 0]
  571.  
  572. [0 0 1 0]
  573.  
  574. [0 0 0 1]
  575.  
  576. ? \\ or hp3=idealpow(nf,hp,3)
  577. ? for(j=1,4,print(idealval(nf,hp3,pd[j])))
  578. 3
  579. 0
  580. 0
  581. 0
  582. ? hpi3=[hp3,[0.,0.]];hr1=ideallllred(nf,hpi3,0)
  583. %8 = [[7, 0, 6, 0; 0, 7, 2, 0; 0, 0, 1, 0; 0, 0, 0, 7], [-
  584. 4.542115783424510364590581431 - 4.894092298183431478504869242*i, -
  585. 3.241524812796742855830829541 - 6.227984987190759939849232263*i]]
  586. ? hr=hr1;for(j=1,3,hr=ideallllred(nf,hr,[1,5]);print(hr))
  587. [[7, 0, 0, 3; 0, 7, 0, 1; 0, 0, 7, 5; 0, 0, 0, 1], [-
  588. 10.55920626489982283311310063 - 3.969550542422284695068789483*i, -
  589. 5.008074927542683607729721315 - 6.637335920436941617757515525*i]]
  590. [[13, 0, 0, 10; 0, 13, 0, 2; 0, 0, 13, 11; 0, 0, 0, 1], [-
  591. 17.55370045383322168333975537 - 3.234391090803506441411369877*i, -
  592. 6.416260543236761408872612244 - 7.814752974898665176450527892*i]]
  593. [[7, 0, 6, 0; 0, 7, 2, 0; 0, 0, 1, 0; 0, 0, 0, 7], [-
  594. 25.04390903221215492540062213 - 2.207432109741074676918714757*i, -
  595. 8.566810186297751680077560554 - 11.91890520832118510749679346*i]]
  596. ? arch=hr[2]-hr1[2];l1=arch[1];l2=arch[2];
  597. ? s=real(l1+l2)/4;v1=[l1,l2,conj(l1),conj(l2)]~/2-[s,s,s,s]~
  598. %10 = [-3.794126968821658934140827421 + 1.343330094221178400793077242*i,
  599. 3.794126968821658934140827421 - 2.845460110565212583823780601*i, -
  600. 3.794126968821658934140827421 - 1.343330094221178400793077242*i,
  601. 3.794126968821658934140827421 + 2.845460110565212583823780601*i]~
  602. ? m1=nf[5][1];m=matrix(4,4,j,k,if(j<=2,m1[j,k],conj(m1[j-2,k])));
  603. ? v=exp(v1);au=gauss(m,v)
  604. %12 = [79.00000000000000000000000006 + 9.693522799760103225000000000 E-27*i, -
  605. 24.00000000000000000000000002 + 1.137188718654215335000000000 E-27*i, -
  606. 14.00000000000000000000000000 - 2.909896133467555046000000000 E-28*i,
  607. 15.00000000000000000000000001 +  0.E-27*i]~
  608. ? vu=round(real(au))
  609. %13 = [79, -24, -14, 15]~
  610. ? u=mod(nf[7]*vu,A)
  611. %14 = mod(15/7*x^3 - 68/7*x^2 - 78/7*x + 79, x^4 - x^3 - 21*x^2 + 17*x + 133)
  612. ? norm(u)
  613. %15 = 1
  614. ? f1=factor(subst(char(u,x),x,x^2))
  615. %16 =
  616. [x^8 + 85*x^6 + 1974*x^4 - 20*x^2 + 1 1]
  617.  
  618. ? f1=factor(subst(char(-u,x),x,x^2))
  619. %17 =
  620. [x^4 + 13*x^3 + 42*x^2 - 8*x + 1 1]
  621.  
  622. [x^4 - 13*x^3 + 42*x^2 + 8*x + 1 1]
  623.  
  624. ? v=sqrt(-v)
  625. %18 = [0.09334880794728281557422432615 - 0.1174246256960511585313775710*i,
  626. 6.593348807947282815574224325 + 0.9834500294804898052951007426*i,
  627. 0.09334880794728281557422432615 + 0.1174246256960511585313775710*i,
  628. 6.593348807947282815574224325 - 0.9834500294804898052951007426*i]~
  629. ? au=gauss(m,v)
  630. %19 = [-4.079490831526613599392561953 - 7.068193709477782249000000000 E-28*i,
  631. 0.9623261373956720055191059533 + 3.553714746609330177000000000 E-29*i,
  632. 1.007652680516380682499122747 + 9.093425419181585311000000000 E-29*i, -
  633. 0.9733355227802970462076159319 - 8.593538112938404083000000000 E-29*i]~
  634. ? v[1]=-v[1];v[3]=-v[3];au=gauss(m,v)
  635. %20 = [-4.000000000000000000000000006 - 6.058451751247048377000000000 E-28*i,
  636. 1.000000000000000000000000002 - 8.884286869317293167000000000 E-29*i,
  637. 1.000000000000000000000000000 + 5.456055251881480216000000000 E-29*i, -
  638. 1.000000000000000000000000001 - 4.296769056469202041000000000 E-29*i]~
  639. ? vu2=round(real(au))
  640. %21 = [-4, 1, 1, -1]~
  641. ? u2=mod(nf[7]*vu2,A)
  642. %22 = mod(-1/7*x^3 + 5/7*x^2 + 1/7*x - 4, x^4 - x^3 - 21*x^2 + 17*x + 133)
  643. ? q=polred2(f1[1,1])
  644. %23 =
  645. [1 x - 1]
  646.  
  647. [1/7*x^3 + 2*x^2 + 7*x - 1/7 x^2 - x + 1]
  648.  
  649. [-x - 3 x^4 - x^3 - 21*x^2 + 17*x + 133]
  650.  
  651. [-4/7*x^3 - 7*x^2 - 21*x + 32/7 x^4 - 2*x^3 + 6*x^2 - 5*x + 133]
  652.  
  653. ? up2=modreverse(mod(q[3,1],f1[1,1]))
  654. %24 = mod(-x - 3, x^4 - x^3 - 21*x^2 + 17*x + 133)
  655. ? mod(subst(lift(up2),x,aut),A)
  656. %25 = mod(1/7*x^3 - 5/7*x^2 - 1/7*x + 4, x^4 - x^3 - 21*x^2 + 17*x + 133)
  657. ? r=f1[1,1]%(x^2+u);-coeff(r,0)/coeff(r,1)
  658. %26 = mod(1/7*x^3 - 5/7*x^2 - 1/7*x + 4, x^4 - x^3 - 21*x^2 + 17*x + 133)
  659. ? al=mod(x^2-9,A)
  660. %27 = mod(x^2 - 9, x^4 - x^3 - 21*x^2 + 17*x + 133)
  661. ? principalidele(nf,al)
  662. %28 = [[-9; 0; 1; 0], [4.071180332419999163417166456 -
  663. 2.351990513650678045072327170*i, -0.1793600343093725532064609704 +
  664. 1.836799691135712939544530673*i]~]
  665. ? for(j=1,4,print(j,": ",idealval(nf,al,pd[j])))
  666. 1: 1
  667. 2: 0
  668. 3: 0
  669. 4: 1
  670. ? norm(al)
  671. %29 = 49
  672. ? pd14=idealmul(nf,pd[1],pd[4])
  673. %30 =
  674. [7 4 5 0]
  675.  
  676. [0 1 0 0]
  677.  
  678. [0 0 1 0]
  679.  
  680. [0 0 0 7]
  681.  
  682. ? idealmul(nf,al,idmat(4))
  683. %31 =
  684. [7 4 5 0]
  685.  
  686. [0 1 0 0]
  687.  
  688. [0 0 1 0]
  689.  
  690. [0 0 0 7]
  691.  
  692. ? setrand(1);v=buchgenfu(A,0.2,0.2)[,1]
  693. %32 = [x^4 - x^3 - 21*x^2 + 17*x + 133, [0, 2], [18981, 7], [1, x, x^2,
  694. 1/7*x^3 + 2/7*x^2 + 6/7*x], [4, [4], [[7, 0, 0, 3; 0, 7, 0, 2; 0, 0, 7, 1; 0,
  695. 0, 0, 1]]], 3.794126968821658934140827422, 0.8826018286655581294913627961, [6,
  696. 1/7*x^3 - 5/7*x^2 - 8/7*x + 8], [1/7*x^3 - 5/7*x^2 - 1/7*x + 4], 150]
  697. ? uf=mod(v[9][1],A)
  698. %33 = mod(1/7*x^3 - 5/7*x^2 - 1/7*x + 4, x^4 - x^3 - 21*x^2 + 17*x + 133)
  699. ? uu=mod(v[8][2],A)
  700. %34 = mod(1/7*x^3 - 5/7*x^2 - 8/7*x + 8, x^4 - x^3 - 21*x^2 + 17*x + 133)
  701. ? cu2=log(conjvec(u2));cuf=log(conjvec(uf));cuu=log(conjvec(uu));
  702. ? lindep(real([cu2[1],cuf[1],cuu[1]]))
  703. %36 = [0, 0, 1]
  704. ? lindep([cu2[1],cuf[1],cuu[1],2*i*pi])
  705. %37 = [1, -1, -3, 0]
  706. ? u2/uf
  707. %38 = mod(-1, x^4 - x^3 - 21*x^2 + 17*x + 133)
  708. ? ru=nf[8]*vvector(4,j,coeff(v[8][2],j-1))
  709. %39 = [8, -2, -1, 1]~
  710. ? nf[7]*ru
  711. %40 = 1/7*x^3 - 5/7*x^2 - 8/7*x + 8
  712. ? setrand(1);bnf=buchinitfu(A,0.2,0.2);
  713. ? bnf[8]
  714. %42 = [[4, [4], [[7, 0, 0, 3; 0, 7, 0, 2; 0, 0, 7, 1; 0, 0, 0, 1]]],
  715. 3.794126968821658934140827422, 0.8826018286655581294913627961, [6, 1/7*x^3 -
  716. 5/7*x^2 - 8/7*x + 8], [1/7*x^3 - 5/7*x^2 - 1/7*x + 4], 150]
  717. ? nf=bnf[7];
  718. ? hp4=idealpow(nf,hp,4)
  719. %44 =
  720. [2401 942 1006 1544]
  721.  
  722. [0 1 0 0]
  723.  
  724. [0 0 1 0]
  725.  
  726. [0 0 0 1]
  727.  
  728. ? vis=isprincipal(bnf,hp4)
  729. %45 = [[0]~, [88, -31, -13, 15]~, 143]
  730. ? alpha=mod(nf[7]*vis[2],A)
  731. %46 = mod(15/7*x^3 - 61/7*x^2 - 127/7*x + 88, x^4 - x^3 - 21*x^2 + 17*x + 133)
  732. ? norm(alpha)
  733. %47 = 2401
  734. ? idealmul(nf,idmat(4),mat(vis[2]))
  735. %48 =
  736. [2401 942 1006 1544]
  737.  
  738. [0 1 0 0]
  739.  
  740. [0 0 1 0]
  741.  
  742. [0 0 0 1]
  743.  
  744. ? vit=isprincipal(bnf,hp)
  745. %49 = [[1]~, [43/7, -15/7, -6/7, 1]~, 139]
  746. ? pp=isprincipal(bnf,pd14)
  747. %50 = [[0]~, [-40, 14, 6, -7]~, 143]
  748. ? al2=mod(nf[7]*pp[2],A)
  749. %51 = mod(-x^3 + 4*x^2 + 8*x - 40, x^4 - x^3 - 21*x^2 + 17*x + 133)
  750. ? u3=al2/al
  751. %52 = mod(-1/7*x^3 + 5/7*x^2 + 1/7*x - 4, x^4 - x^3 - 21*x^2 + 17*x + 133)
  752. ? char(u3,x)
  753. %53 = x^4 - 13*x^3 + 42*x^2 + 8*x + 1
  754. ? me=concat(bnf[3],[2,2]~)
  755. %54 =
  756. [-3.794126968821658934140827422 + 10.76810805499055811618100739*i 2]
  757.  
  758. [3.794126968821658934140827422 + 6.579317850204167131564149548*i 2]
  759.  
  760. ? cu3=principalidele(nf,u3)[2]
  761. %55 = [-3.794126968821658934140827422 + 4.484922747810971639255720625*i,
  762. 3.794126968821658934140827422 + 0.2961325430245806546388627815*i]~
  763. ? xc=gauss(real(me),real(cu3))
  764. %56 = [1.000000000000000000000000000,  0.E-48]~
  765. ? xd=cu3-me*xc
  766. %57 = [ 0.E-47 - 6.283185307179586476925286766*i,  0.E-47 -
  767. 6.283185307179586476925286766*i]~
  768. ? xu=principalidele(nf,uu)[2]
  769. %58 = [7.646841173435770929738625909 E-57 + 2.094395102393195492308428922*i, -
  770. 9.558551466794713662173282386 E-58 - 2.094395102393195492308428922*i]~
  771. ? xd[1]/xu[1]
  772. %59 = -3.000000000000000000000000000 +  0.E-47*i
  773. ? isunit(bnf,u3)
  774. %60 = [1, mod(3, 6)]
  775. ? uu^3*uf
  776. %61 = mod(-1/7*x^3 + 5/7*x^2 + 1/7*x - 4, x^4 - x^3 - 21*x^2 + 17*x + 133)
  777. ?
  778.  
  779.  
  780. ----------------------- End example readme file --------------
  781.  
  782.  
  783. I hope this helps to answer your question. :-)
  784.  
  785.  
  786. --
  787. Bye Manou
  788. ------------------------_----------------------------------------------
  789. Manou BILLA       |  _ //  Connect your AMIGAs...
  790. 4, Ave. Nic Kreins|  \X/             ... A1000 / A2500 / A3000 ...
  791. L-9536 WILTZ      |      ------ Member Team AMIGA Luxembourg ------
  792.                   | email manou.billa@ci.educ.lu      FIDO 2:2455/560.8
  793. -----------------------------------------------------------------------
  794.            [PGP public key available on request]
  795.  
  796. ... It is by coffee alone I set my mind in motion.
  797.     It is by the beans of Java that thoughts aquire speed.
  798.     The hands aquire shaking, the shaking is a warning.
  799.     It is by coffee alone I set my mind in motion.
  800.  
  801.